﻿using System.Collections.Immutable;
using _18自引用的组织结构树.EntityClass;
using Microsoft.EntityFrameworkCore;

namespace _18自引用的组织结构树;

public class MyDbContext:DbContext
{
    public DbSet<OrgUnit> OrgUnits { get; set; }
    public DbSet<Teacher> Teachers { get; set; }
    public DbSet<Student> Students { get; set; }
    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        base.OnConfiguring(optionsBuilder);
        optionsBuilder.UseSqlServer("Server=.;Database=efCorePractice_3;Trusted_Connection=True;MultipleActiveResultSets=true;TrustServerCertificate=true;");
    }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        base.OnModelCreating(modelBuilder);
        modelBuilder.ApplyConfigurationsFromAssembly(GetType().Assembly);
    }
}